using System;
using System.Threading;
using Fibers;

class A : Fiber {
	protected override void Run() {
		Console.WriteLine("Fiber {0} on CLR thread {1}, OS thread {2}",
			this.GetHashCode(),
			Thread.CurrentThread.GetHashCode(),
			AppDomain.GetCurrentThreadId());
		while(true)
			Yield("hello");
	}
	public static void Main(String[] args) {
		A[] arr = new A[4];
		for(int i = 0; i < arr.Length; ++i)
			arr[i] = new A();
		for(int i = 0; i < arr.Length; ++i)
			arr[i].Resume();
		for(int i = 0; i < arr.Length; ++i)
			arr[i].Dispose();
		Console.WriteLine("main exiting");
	}
}
